package com.zzz.dynamicds.controller;

import com.alibaba.fastjson.JSON;
import com.zzz.dynamicds.service.CommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

/**
 * @author ZZZ
 * @version 1.0
 * @date 2019/7/1 0001
 */
@RestController
public class TestController {

    @Autowired
    private CommonService commonService;

    @GetMapping("/getAllField1/{tableName}")
    public String getAllField1(@PathVariable String tableName) {
        Set<String> allFields = commonService.getAllField1(tableName, "6.27_test");
        return JSON.toJSONString(allFields);
    }

    @GetMapping("/getAllField2/{tableName}")
    public String getAllField2(@PathVariable String tableName) {
        Set<String> allFields = commonService.getAllField2(tableName, "bj_zh_6.27");
        return JSON.toJSONString(allFields);
    }

    @GetMapping("/getTableDiff")
    public String getTableDiff() {
        return commonService.getTableDiff();
    }
}
